From 591dc095a0e5f655e419ec4d1ae11d8f54bed196 Mon Sep 17 00:00:00 2001
From: "HATEC\\SPVDEV001" <tri.susilo@altama.co.id>
Date: Mon, 9 Oct 2023 10:51:46 +0700
Subject: update fitur variant page

---
 src/pages/shop/product/variant/[slug].jsx | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

(limited to 'src/pages/shop/product/variant/[slug].jsx')

diff --git a/src/pages/shop/product/variant/[slug].jsx b/src/pages/shop/product/variant/[slug].jsx
index ba2a79d5..d0790249 100644
--- a/src/pages/shop/product/variant/[slug].jsx
+++ b/src/pages/shop/product/variant/[slug].jsx
@@ -6,6 +6,7 @@ import dynamic from 'next/dynamic'
 import { useRouter } from 'next/router'
 import cookie from 'cookie'
 import variantApi from '@/lib/product/api/variantApi'
+import axios from 'axios'
 
 const BasicLayout = dynamic(() => import('@/core/components/layouts/BasicLayout'))
 const Product = dynamic(() => import('@/lib/product/components/Product/Product'))
@@ -15,9 +16,16 @@ export async function getServerSideProps(context) {
   const cookies = context.req.headers.cookie
   const cookieObj = cookies ? cookie.parse(cookies) : {}
   const auth = cookieObj.auth ? JSON.parse(cookieObj.auth) : {}
+  const tier = auth.pricelist ? auth.pricelist : false
   const authToken = auth?.token || ''
 
-  let product = await variantApi({ id: getIdFromSlug(slug), headers: { Token: authToken } })
+
+  let response = await axios(
+    `${process.env.NEXT_PUBLIC_SELF_HOST}/api/shop/variant-detail?id=` + getIdFromSlug(slug) +'&auth=' + tier
+  )
+  let product = response.data
+  // let product = await variantApi({ id: getIdFromSlug(slug), headers: { Token: authToken } })
+  
   if (product?.length == 1) {
     product = product[0]
    /* const regexHtmlTags = /(<([^>]+)>)/gi
-- 
cgit v1.2.3

